package com.sky.web.admin;

import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/shop")
public class ShopController {

    @Autowired
    private RedisTemplate redisTemplate;

    //店铺的营业状态
    @PutMapping("/{status}")
    public Result shopStatus(@PathVariable Integer status) {
        redisTemplate.opsForValue().set("SHOP_STATUS", status);
        return Result.success();
    }

    //查询店铺的营业状态
    @GetMapping("/status")
    public Result shopStatus() {
        return Result.success(redisTemplate.opsForValue().get("SHOP_STATUS"));
    }

}
